//
//  LeftVC.m
//  SideDemo
//
//  Created by zsp on 16/4/8.
//  Copyright © 2016年 zsp. All rights reserved.
//

#import "LeftVC.h"

#import <MMDrawerController.h>
#import <MMDrawerController/UIViewController+MMDrawerController.h>
#import "ContentAaaVC.h"
#import "ContentBbbVC.h"

@interface LeftVC ()

@end

@implementation LeftVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self configView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark -
- (void)configView {
    UIButton *infoButton=[UIButton buttonWithType:UIButtonTypeInfoDark];
    infoButton.center=self.view.center;
    [infoButton addTarget:self action:@selector(toOpenAaaVC:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:infoButton];
    
    UIButton *bbbButton=[UIButton buttonWithType:UIButtonTypeInfoLight];
    bbbButton.center=CGPointMake(self.view.center.x, self.view.center.y +120);
    [bbbButton addTarget:self action:@selector(toOpenBbbVC:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:bbbButton];
}

- (void)toOpenAaaVC:(UIButton*)sender {
    ContentAaaVC *aaaVC=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ContentAaaVC"];
    aaaVC.title=@"ContentAaaVC";
    [self.mm_drawerController closeDrawerAnimated:YES completion:nil];
//    [self.mm_drawerController setCenterViewController:[[UINavigationController alloc] initWithRootViewController:aaaVC] withCloseAnimation:YES completion:nil];
    
    [(UINavigationController*)(self.mm_drawerController.centerViewController) pushViewController:aaaVC animated:YES];
}

- (void)toOpenBbbVC:(UIButton*)sender {
    ContentBbbVC *bbbVC=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"ContentBbbVC"];
    bbbVC.title=@"ContentBbbVC";
    [self.mm_drawerController closeDrawerAnimated:YES completion:nil];
//    [self.mm_drawerController setCenterViewController:[[UINavigationController alloc] initWithRootViewController:bbbVC] withCloseAnimation:YES completion:nil];
    [(UINavigationController*)(self.mm_drawerController.centerViewController) pushViewController:bbbVC animated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (void)dealloc {
    NSLog(@"%s - %s",__FILE__, __func__);
}
@end
